package com.nbsaas.boot.merchant.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

import java.math.BigDecimal;
import java.util.Date;

@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "商家结算", model = "商家结算")
@Entity
@Table(name = "bs_merchant_settlement")
@Comment("商家结算表")
public class MerchantSettlement extends AbstractEntity {

    @Comment("商家ID")
    @FormField(title = "商家", sortNum = "1", type = InputType.select, required = true)
    private Long merchantId;

    @Comment("结算单号")
    @SearchItem(name = "settlementNo", key = "settlementNo", label = "结算单号")
    @FormField(title = "结算单号", sortNum = "2", grid = true, required = true)
    @Column(length = 50, nullable = false, unique = true)
    private String settlementNo;

    @Comment("结算周期")
    @SearchItem(name = "settlementPeriod", key = "settlementPeriod", label = "结算周期")
    @FormField(title = "结算周期", sortNum = "3", grid = true, type = InputType.select)
    @Column(length = 20)
    private String settlementPeriod;

    @Comment("开始日期")
    @FormField(title = "开始日期", sortNum = "4", type = InputType.date)
    private Date startDate;

    @Comment("结束日期")
    @FormField(title = "结束日期", sortNum = "5", type = InputType.date)
    private Date endDate;

    @Comment("订单数量")
    @FormField(title = "订单数量", sortNum = "6", type = InputType.el_input_number, grid = true)
    private Integer orderCount;

    @Comment("订单金额")
    @FormField(title = "订单金额", sortNum = "7", type = InputType.el_input_number, grid = true)
    @Column(precision = 12, scale = 2)
    private BigDecimal orderAmount;

    @Comment("佣金金额")
    @FormField(title = "佣金金额", sortNum = "8", type = InputType.el_input_number, grid = true)
    @Column(precision = 12, scale = 2)
    private BigDecimal commissionAmount;

    @Comment("退款金额")
    @FormField(title = "退款金额", sortNum = "9", type = InputType.el_input_number, grid = true)
    @Column(precision = 12, scale = 2)
    private BigDecimal refundAmount;

    @Comment("结算金额")
    @FormField(title = "结算金额", sortNum = "10", type = InputType.el_input_number, grid = true)
    @Column(precision = 12, scale = 2)
    private BigDecimal settlementAmount;

    @Comment("结算状态")
    @SearchItem(name = "settlementStatus", key = "settlementStatus", label = "结算状态")
    @FormField(title = "结算状态", sortNum = "11", grid = true, type = InputType.select)
    @Column(length = 20)
    private String settlementStatus;

    @Comment("结算时间")
    @FormField(title = "结算时间", sortNum = "12")
    private Date settlementTime;

    @Comment("结算人ID")
    @FormField(title = "结算人", sortNum = "13", type = InputType.select)
    private Long settlementUser;

    @Comment("备注")
    @FormField(title = "备注", sortNum = "14", type = InputType.textarea)
    @Column(length = 1000)
    private String remark;
} 